package com.cljh.mapper;

import com.cljh.bean.Product;
import com.cljh.bean.Sale;
import com.cljh.bean.SaleTable;
import com.cljh.controller.page.ProductPageBean;
import com.cljh.controller.page.SalePageBean;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SaleMapper {

    List<SaleTable> selectAllByCondition(@Param("begin")Integer begin, @Param("size") Integer size, @Param("saleTable") SaleTable saleTable);

    @Delete("delete from mtmall_test.sale_table where id=#{id};")
    int deleteId(Integer id);


    int upd(@Param("saleTable") SaleTable saleTable);

    int deleteAll(@Param("ids") List<Integer> ids);


    SaleTable selectBySaleId(Integer id);

    int selectCount(@Param("saleTable") SaleTable saleTable);


    @Delete("delete from mtmall_test.sale where table_id=#{id};")
    int deleteByIdInt(Integer id);


    @Select("select * from mtmall_test.sale_table;")
    List<SaleTable> selectAll();

    @Select("select * from mtmall_test.sale;")
    List<Sale> selectSale();

    List<Sale> selectAllSales(String types);


    List<SaleTable> selectByUsername(@Param("username") String username);

    int saveSaleTable(@Param("saleTable") SaleTable saleTable);


    int saveSales(@Param("sales") List<Sale> sales);
}
